<template>
  <div id="data-box5">
    <el-table
        :data="tableData"
        style="width: 100%"
        :row-class-name="tableRowClassName">
      <el-table-column
          align="center"
          prop="value"
          label="房屋规模"
          width="400">
      </el-table-column>
      <el-table-column
          align="center"
          prop="number"
          label="汇总数量"
          width="400">
      </el-table-column>
    </el-table>
  </div>
</template>

<style>
#data-box5 .el-table .warning-row {
  background: oldlace;
}

#data-box5 .el-table .success-row {
  background: #f0f9eb;
}
</style>

<script>

export default {
  name: "VisualizationFive",
  methods: {
    tableRowClassName({ rowIndex}) {
      if (rowIndex === 1) {
        return 'warning-row';
      } else if (rowIndex === 3) {
        return 'success-row';
      }
      return '';
    },
    open1(msg) {
      this.$notify({
        title: msg,
        message: '这是一条成功的提示消息',
        type: 'success'
      });
    },
    open2(msg) {
      this.$notify({
        title: msg,
        message: '这是一条警告的提示消息',
        type: 'warning'
      });
    },
    open4(msg) {
      this.$notify.error({
        title: msg,
        message: '这是一条错误的提示消息'
      });
    },
    getData(){
      this.$axios.get('/api/vis/getData6', {

      }).then(res =>{

        if (res.data.code === 20041) {
          let data = [];
          for (let i = 0; i < res.data.data.length; i++) {
            data.push(
                {value: res.data.data[i]["param"], number: res.data.data[i]["param1"]}

            );
          }
          this.tableData = data;
        }

      }).catch(error =>{
        error = "系统出错了"
        this.open4(error)
      })
    }
  },
  data() {
    return {
      tableData: []
    }
  },
  mounted() {
    this.getData();
  },

}
</script>